#include <stdio.h>
#include <stdbool.h>
void split_date(int day_of_year, int year, int *month, int *day);
bool is_leap_year(int year);
int main(void)
{
    int day_of_year = 31 + 29 + 2;
    int year = 2000;
    int month, day;
    split_date(day_of_year, year, &month, &day);
    printf("%d %d\n", month, day);
    return 0;
}
bool is_leap_year(int year) {
    if (year % 400 == 0)
        return true;
    if (year % 100 == 0)
        return false;
    if (year % 4 == 0)
        return true;
    return false;
}
void split_date(int day_of_year, int year, int *month, int *day) {
    for (int m = 1; m <= 12; m++) {
        int left_day;
        switch (m)
        {
        case 1: case 3: case 5: case 7: case 8: case 10: case 12:
            left_day = day_of_year - 31;
            break;
        case 4: case 6: case 9: case 11:
            left_day = day_of_year - 30;
            break;
        case 2:
            if (is_leap_year)
                left_day = day_of_year - 29;
            else
                left_day = day_of_year - 28;
            break;
        }
        if (left_day <= 0) {
            *month = m;
            *day = day_of_year;
            return;
        }
        day_of_year = left_day;
    }
}